#pragma once
#include <chrono>
#include <format>
#include <iostream>
#include <string>

// 简单的性能计时器
class Timer
{
public:
    Timer(const std::string& name) : name_(name), start_(std::chrono::high_resolution_clock::now()) {}

    ~Timer()
    {
        auto end = std::chrono::high_resolution_clock::now();
        auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start_);
        std::cout << std::format("[{}] Time taken: {} μs\n", name_, duration.count());
    }

private:
    std::string name_;
    std::chrono::high_resolution_clock::time_point start_;
};
